import { request } from '@/framework/utils/request-jdz';

// 搜索用户列表
export const userSearch = (params) => {
  return request(
    {
      url: '/user/',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 获取用户列表
export const userList = (params) => {
  return request(
    {
      url: '/user-plus/',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 删除平台用户
export const userDelete = (id) => {
  return request(
    {
      url: `/user-plus/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 重置平台用户密码
export const resetPass = (id) => {
  return request(
    {
      url: `/user-plus/password/reset?userId=${id}`,
      method: 'patch',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 用户启用
export const userEnable = (id) => {
  return request(
    {
      url: '/user/enable/' + id,
      method: 'put',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 用户禁用
export const userDisable = (id) => {
  return request(
    {
      url: '/user/disable/' + id,
      method: 'put',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 用户详情
export const userDetail = (id) => {
  return request(
    {
      url: `/user-plus/${id}`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const userAdd = (params) => {
  return request(
    {
      url: '/user-plus/',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const userUpdate = (params) => {
  return request(
    {
      url: `/user-plus/${params.id}`,
      method: 'put',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
